#pragma once

#include <iostream>
#include <initializer_list>
#include "Define.h"

#define GLOG_NO_ABBREVIATED_SEVERITIES
#include <glog/logging.h>

namespace wsbus {

	CUBEBOTBUS_API void initLog(const char *prefix, const char* path, bool console = false, int level = 0);
	CUBEBOTBUS_API void sleepSecond(int second);
	CUBEBOTBUS_API void sleepMillisec(int millisec);
	CUBEBOTBUS_API time_t currentMillisecond();
	CUBEBOTBUS_API std::string getLocalUserPath();
	CUBEBOTBUS_API bool createDirectories(const std::string &path);
	CUBEBOTBUS_API std::string runDir();
	CUBEBOTBUS_API std::string getBusUserSettingPath();
	CUBEBOTBUS_API std::string getBusUserSessionIdPath();
	CUBEBOTBUS_API std::string pathNormalize(const std::string &path);
	CUBEBOTBUS_API std::string pathNormalize(std::initializer_list<std::string> names);
	CUBEBOTBUS_API void saveBusPort(unsigned short port);
	CUBEBOTBUS_API unsigned short getBusPort();
	CUBEBOTBUS_API unsigned long getCurrentProcessId();
	CUBEBOTBUS_API int getCurrentSessionId();
	template<class T>
	void vectorRemoveItem(std::vector<T> &vec, const T &t) {
		vec.erase(std::remove(vec.begin(), vec.end(), t), vec.end());
	}

}
